package ricm4.ar.tp2;
import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import ricm4.ar.tp2.ISupplier;



public class Supplier extends UnicastRemoteObject implements ISupplier {
	/**
	 * 
	 */
	private static final long serialVersionUID = -66237735879650638L;
	private int num;
	
	public Supplier(int num) throws RemoteException {
		super();
		this.num=num;
	}

	@Override
	public String question() throws RemoteException {
		return System.getProperty("os.name");
	}

	@Override
	public String question(String s) throws RemoteException {
		return System.getProperty(s);
	}
	
	@Override
	public void question(Appendable s) throws IOException, RemoteException { 
		System.out.println("calling question(Appendable)"); 
		s.append(question(s.toString()));
	}

	@Override
	public IProperty question(StringBuilder s) throws RemoteException{ 
		System.out.println("calling question(StringBuilder)"); 
		return new Property(System.getProperty(s.toString()));
	}
	
	@Override
	public String name() throws RemoteException {
		return toString();
	}

	public String toString(){ return "supplier"+num ;}
}
